package org.adapter;

import java.util.List;

import org.cmn.ProductPojo;
import org.design.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class ProductAdapter extends GenericAdapter {
	public ProductAdapter(Context context, List<ProductPojo> allProducts) {
		super(context, allProducts);
	}

	public int getCount() {
		return getResulstList().size();
	}

	public Object getItem(int position) {
		return getResulstList().get(position);
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	public void onClick(View arg0) {
		// TODO Auto-generated method stub

	}

	public View getView(int position, View convertView, ViewGroup viewGroup) {
		ProductPojo entry = (ProductPojo) getResulstList().get(position);
		if (convertView == null) {
			LayoutInflater inflater = (LayoutInflater) getContext()
					.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			convertView = inflater.inflate(R.layout.product_row, null);
		}
		TextView productName = (TextView) convertView
				.findViewById(R.id.productNamePattern);
		productName.setText(entry.getName());

		return convertView;
	}

}
